new Vue({
  el: '#app',
  data() {
    return {
      form: {
        Article_Name: "",
        page: 1,			//页数
        limit: 10			//每页数据条数
      },
      formData: {},
      tableData: [{}],		//表格数据
      total: 0,
      dialogForm: false,
      title: '',
      multipleSelection: []
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    onSerach() {				//查询方法
      let _this = this
      console.log(_this.form.Article_Name)
      $.ajax({
        type: 'POST',
        url: DomainName + "/getArticleBlurredAction",
        data: {
          Article_Name: _this.form.Article_Name,
          token: $.cookie("token")
        },
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (Result) {
          console.log(Result);
          _this.tableData = Result
        },
        dataType: "json"
      });
    },
    addContract() {
      console.log("跳转")
    },
    getList() {     //换页方法
      let _this = this
      $.ajax({
        type: 'POST',
        url: DomainName + "/getArticleBlurredAction",
        data: {
          Article_Name: _this.form.Article_Name,
          token: $.cookie("token")
        },
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (Result) {
          console.log(Result);
          _this.tableData = Result
          _this.total = _this.tableData.length
        },
        dataType: "json"
      });
    },
    handleChildren(row) {
      _this = this
      if (!row.Children.article_specifications.length) {
        console.log(row.Children.article_specifications.length)
        $.ajax({
          url: DomainName + '/getSpecificationsAction',
          type: 'POST',
          data: {
            Article_SerialNumber: row.Article_SerialNumber,
            token: $.cookie("token")
          },

          success: function (data) {
            console.log(data)
            // data.forEach(item => {
            //   item.Picture_URL = DomainName + item.Picture_URL
            // })
            row.Children.article_specifications = data
            // console.log(expandedRows[expandedRows.length - 1].Children.article_specifications)
          },
          dataType: "json"
        });
      }

    },
    handleSizeChange(val) {
      this.form.page = 1;
      this.form.limit = val;
    },
    handleCurrentChange(val) {
      this.form.page = val;
    },
    handlePreview(Article_SerialNumber) {
      this.Pic = []
      this.tablePic.filter(item => {
        return item.Picture_Type == '0' && item.Article_SerialNumber == Article_SerialNumber
      }).forEach(item => {
        this.Pic.push(item.Picture_Url)
      })
      console.log(this.Pic);
    },
    addEnterprise() {
      window.location.href = './Add.html'
    },
    showMember(EnterpriseInfo_SerialNumber) {
      sessionStorage.setItem("EnterpriseInfo_SerialNumber", EnterpriseInfo_SerialNumber)
      window.location.href = './show.html?EnterpriseInfo_SerialNumber=' + EnterpriseInfo_SerialNumber
    },
    editMember(EnterpriseInfo_SerialNumber) {
      sessionStorage.setItem("EnterpriseInfo_SerialNumber", EnterpriseInfo_SerialNumber)
      window.location.href = './Edit.html?EnterpriseInfo_SerialNumber=' + EnterpriseInfo_SerialNumber
    },
  },
})